﻿package payments;
import java.awt.*;
import java.awt.event.*;

public class YesDialog extends Dialog implements ActionListener {

	private static final long serialVersionUID = 1L;
	
	private Button yes = new Button("ok");
		
	private boolean result;

  public YesDialog(Frame parent, String message)
  {
    super(parent, true);
    
    Panel p = new Panel();
    p.setLayout(new GridBagLayout());
    
    p.add(new Label(message),new GridBagConstraints(1, 0, 2, 1, 1, 0,
            GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    yes.addActionListener(this);
    p.add(yes,new GridBagConstraints(1, 2, 1, 1, 1, 1,
            GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
           	
    this.add(p);
    this.setSize(300,100);
    //this.setLocation(50, 50);
    this.pack();
  }  
  
  public void actionPerformed(ActionEvent evt) {
	
	  if (evt.getSource() == yes) result = true;
	    else result = false;
	  
	  this.setVisible(false);
	  this.dispose();
  }
  
  public boolean getResult() {
	    return result;
	  }
}